﻿<%@ Page Title="新闻列表" Language="C#" MasterPageFile="~/Areas/Manage/Views/Shared/Master.Master"
    Inherits="System.Web.Mvc.ViewPage<PagedList<ENews>>" %>

<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <% using (Html.BeginForm())
       {%>
    <table class="table">
        <tr>
            <td>
                关键字：<%=Html.TextBox("tilte")%>
                <%=Html.DropDownList("classifyList")%>
                <input type="submit" id="search" name="search" value="搜 索" />
            </td>
        </tr>
    </table>
    <%} %>
    <table class="table">
        <tr>
            <th>
                编 号
            </th>
            <th>
                标 题
            </th>
            <th>
                类 别
            </th>
            <th>
                作 者
            </th>
            <th>
                有效性
            </th>
            <th>
                时 间
            </th>
            <th>
                序 号
            </th>
            <th>
                操 作
            </th>
        </tr>
        <%
            int i = 0;
            foreach (ENews news in Model)
            {
                i++;
        %>
        <tr>
            <td>
                <%=i %>
            </td>
            <td>
                <%=news.Title%>
            </td>
            <td>
                <%=news.ClassifyName%>
            </td>
            <td>
                <%=news.Author%>
            </td>
            <td>
                <%=news.Isvalid ? "√" : "×"%>
            </td>
            <td>
                <%=news.WriteTime.ToString("yyyy-MM-dd HH:mm:ss") %>
            </td>
            <td>
                <%=news.SortId%>
            </td>
            <td>
                <%= Html.ActionLink("修 改", "Edit", "News", new { newsId=news.NewsId }, null)%>
                <%=Html.Hidden("newsId", news.NewsId)%>
                <input type="button" name="delete" value="删 除" />
            </td>
        </tr>
        <%
}
        %>
        <tr>
            <td colspan="2">
                <span>共<%=Model.TotalItemCount %>条记录， 页<%=Model.CurrentPageIndex %>/<%=Model.TotalPageCount %></span>
            </td>
            <td colspan="6" align="right">
                <%=Html.Pager(Model,new PagerOptions{ContainerTagName="span", PageIndexParameterName="NewsId",AlwaysShowFirstLastPageNumber = true,HorizontalAlign="right"}) %>
            </td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cssLink" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="jsLink" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cssContent" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="jsContent" runat="server">
    <script type="text/javascript">
        $(function () {
            $(":button[name='delete']").click(function () {
                if (confirm("删除提示!\n确定要删除吗")) {
                    var newsId = $(this).parent().find(":hidden[name='newsId']").val();
                    $.post('<%=Url.Action("Delete") %>', { newsId: newsId }, function () { location.reload(); });
                }
            });
        });
    </script>
</asp:Content>
